从QQ和微信打开轨迹

从QQ和微信打开轨迹 

@Override
protected void onResume() {
	super.onResume();
	mMapView.onResume();
	mBaiduMap.clear();
	points = null;

	String filepath;
	Intent intent = getIntent();
	String action = intent.getAction();
	Log.e(Thread.currentThread().getStackTrace()[2] + "", action + "");
	if (intent.ACTION_VIEW.equals(action)) {
		Uri uri = intent.getData();
        //filepath = uri.toString();
        // QQ:content://com.tencent.mobileqq.fileprovider/external_files/storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/QQfile_recv/%E9%BD%90%E5%A4%A9%E5%B2%AD-%E8%B6%B3%E7%90%83%E8%AE%AD%E7%BB%83%E5%9F%BA%E5%9C%B0-%E5%8C%97%E6%B2%9F-%E7%99%BD%E7%80%91%E5%AF%BA-%E7%A2%BE%E6%88%BF%E6%B0%B4%E5%BA%93-%E9%9D%99%E5%BF%83%E5%B1%B1%E5%BA%84-%E9%AB%98%E5%B4%96%E5%8F%A3.gpx
        // 微信:content:/[email protected]/external/Android/data/com.tencent.mm/MicroMsg/b7e2b82341dbb86b43fd19f9590f0577/attachment/content_1615190457891
        //filepath = uri.getEncodedPath();
        // QQ:/external_files/storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/QQfile_recv/%E9%BD%90%E5%A4%A9%E5%B2%AD-%E8%B6%B3%E7%90%83%E8%AE%AD%E7%BB%83%E5%9F%BA%E5%9C%B0-%E5%8C%97%E6%B2%9F-%E7%99%BD%E7%80%91%E5%AF%BA-%E7%A2%BE%E6%88%BF%E6%B0%B4%E5%BA%93-%E9%9D%99%E5%BF%83%E5%B1%B1%E5%BA%84-%E9%AB%98%E5%B4%96%E5%8F%A3.gpx
        // 微信:/external/Android/data/com.tencent.mm/MicroMsg/b7e2b82341dbb86b43fd19f9590f0577/attachment/content_1615190457891
        filepath = Uri.decode(uri.getEncodedPath());
        // QQ:/external_files/storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/QQfile_recv/齐天岭-足球训练基地-北沟-白瀑寺-碾房水库-静心山庄-高崖口.gpx
        // 微信:/external/Android/data/com.tencent.mm/MicroMsg/b7e2b82341dbb86b43fd19f9590f0577/attachment/content_1615190457891
        if (filepath.startsWith("/external_files/"))
            filepath = filepath.replace("/external_files/", "/");
        else if (filepath.startsWith("/external/"))
            filepath = filepath.replace("/external/", Environment.getExternalStorageDirectory().getPath() + "/");
            Log.e(Thread.currentThread().getStackTrace()[2] + "", filepath);
		} else {
			String filename = intent.getStringExtra("filename");
			filepath = Environment.getExternalStorageDirectory().getPath() + "/LocusMap/" + filename;
	}
	points = RWXML.read(filepath);
	Drawgpx();
}

SingleInstance的Activity多次传入Intent不会改变

https://blog.csdn.net/chenxiruanhai/article/details/22959145

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
}

 

你可能感兴趣的:(Android)