mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 08:31:04 +02:00
21a4c8eadc
This allows you to share either .love game to launch as game (for the non-fused APKs and instance of LOVE isn't running) or any file that gets passed as love.filedropped. Caveat: Ensure the intended game is running before sending files to LOVE app. Otherwise, LOVE will attempt to open it as *.love file, which is may not what you want.
29 lines
875 B
Java
29 lines
875 B
Java
package org.love2d.android;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
public class IntentReceiverActivity extends Activity {
|
|
@Override
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
|
|
Intent mainIntent = getIntent();
|
|
Intent intent = new Intent(this, GameActivity.class);
|
|
|
|
if (mainIntent.getAction().equals(Intent.ACTION_SEND)) {
|
|
// Convert to simpler intent that our GameActivity can process.
|
|
Uri uri = mainIntent.getParcelableExtra(Intent.EXTRA_STREAM);
|
|
intent.setData(uri);
|
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
}
|
|
|
|
startActivity(intent);
|
|
finish();
|
|
}
|
|
}
|