Hi everyone.
I face a problem and still can’t solve it after 2 days
I create an scheme in my android manifest and also created an android plugin by extending UnityPlayerActivity . What does this plugin does is that It open a web browser that redirect user to some payment gateway . That payment gateway return the payment result by calling a callback url . I use android scheme that I created in my Android manifest to get the result back from gateway payment . It does and return to my unity game , Obviously I want to get the Uri data on my Unity Activity but it always null . I check a few activity callback to get the uri data but without success . Here is what happen in my Activity :
onCreate method : It never be called
onResume method : it is always null
onNewIntent(Intent intent) : it is always null
This is my MainActivity Class that is extend UnityPlayerActivity :
//This method is called only once in startup , but it is not called after
//returning from web browser
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.data = getIntent().getData();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
this.data = intent.getData();
//data is always null
}
@Override
protected void onResume() {
super.onResume();
this.data = getIntent().getData();
//data is always null
}
And here is my android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".MainActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="return" android:host="zarinpalpayment" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
</application>
</manifest>
Does anybody know How can I get scheme data in my MainActivity class.
Any help would be greatly appreciated.