浏览器唤醒app
</activity> <activity android:name="com.siyunetwork.wxpluginforunity.AwakenActivity"> <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:host="com.siyunetwork.zhixiang.majiang" android:scheme="app"/> </intent-filter> </activity>
安卓工程需要先写个activity用来唤醒
public class AwakenActivity extends Activity { String dataString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent=getIntent(); Intent intent1=new Intent(); intent1.setClass(AwakenActivity.this, MainActivity.class); //设置跳转的Activity if (intent!=null) { String action=intent.getAction(); dataString=intent.getDataString(); Log.d("hhh",dataString); intent1.putExtra("dataString",dataString); } AwakenActivity.this.startActivity(intent1); finish(); } }
类里面重写onCreate方法,设置唤醒
String dataString; @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); Intent intent=getIntent(); dataString= intent.getStringExtra("dataString"); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); dataString= intent.getStringExtra("dataString"); sendToUnity(); }
再在mainActivity向unity发送数据
通过Html唤醒
(以上内容仅供自己参考)