Receiving Simple Data from Other Apps Using Sketchware



Add this code in onCreate :

// Get intent, action and MIME type
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
 if ("text/plain".equals(type)) {
  shared = intent.getStringExtra(Intent.EXTRA_TEXT);
  YourWidget.setText(shared);
 }
}


Inject this code in manifest.xml :

<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.SEND" />
 <category android:name="android.intent.category.DEFAULT" />
 <data android:mimeType="text/plain" />
  </intent-filter>

Video tutorial
 

Comments

Popular posts from this blog

Read Json file from asset in Sketchware Pro

Change wallpaper Programmatically Sketchware

Web Scraping With Jsoup in Sketchware