I'm making an extension to update the operating system that there's a new image file, it gets called by a function in GM:S like this:
osNotice(files+"/newButtonSkin.png");
Note that the variable files is the absolout path
then the function sends this as a string to the java class extension:
package ${YYAndroidPackageName};//Import the GM:S stuff
import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.lang.String;
public class PickMe extends Activity {
public final void osNotice(String fupdate)//Notify the OS that there's a new media file available
{
Log.i("yoyo", "New file to alert os- "+fupdate);
String canAlert = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(canAlert))
{
File file = new File(fupdate);
Log.i("yoyo", "File ready to send- "+ fupdate);
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file));
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
sendBroadcast(intent);
Log.i("yoyo", "Updated sucessfully! "+fupdate);
}
else
Log.i("yoyo", "Could not update file- "+fupdate);
}
}
in my manifest I have injected:
<activity android:name=".PickMe"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Here's a screenshot of the log file when the game is run:
The result of running the app is that the image is not updated to the os, Why isn't the intent being run? and why does the log say "can't find method on extension class: null" when I know the method is being run?