Android Question Share image and text Social Media

ilan

Expert
Licensed User
Longtime User
hi

i searching for a while on the forum for a solution to share content (image + text) to social media and i have also tried some but cannot find something that is really working.

i just would like to share an image and text to facebook, twitter, WhatsApp, email,..

b4i has a great library that works perfect but i cannot find something similar for b4a.

any suggestions?

it should work on any android version (at least android and up incl. android 8)

thanx
 

ilan

Expert
Licensed User
Longtime User
See my answer here: https://www.b4x.com/android/forum/t...le-with-fileprovider-share.78196/#post-495544

Any solution not based on FileProvider is wrong.

thanx erel i have tried your example (first) and it did not work for me this is why i opened this thread.

this is the crash log:

Logger connected to: ce031713a972c8c80c
--------- beginning of main
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
--------- beginning of system
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
Copying updated assets files (2)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 50 (Main)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at b4a.example.main._createfileprovideruri(main.java:459)
at b4a.example.main._button1_click(main.java:419)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6261)
at android.widget.TextView.performClick(TextView.java:11180)
at android.view.View$PerformClick.run(View.java:23748)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/b4a.example/files/shared/1.bal
at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:679)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:378)
... 23 more
** Activity (main) Pause, UserClosed = true **
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
Which device are you using? What is the output of Log(File.ExternalWritable) ?

I am using galaxy s8

I need to mention that when i start the app i dont get any permission request. In the service there is also no request only a declaration but no request call. Should it be like that?
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
What is the output? Does it throw an error?

Logger connected to: ce031713a972c8c80c
--------- beginning of crash
--------- beginning of main
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
--------- beginning of system
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
*** Service (starter) Create ***
/storage/emulated/0/Android/data/b4a.example/files/shared
true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **

but if i click on the button i get this:

Logger connected to: ce031713a972c8c80c
--------- beginning of crash
--------- beginning of main
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
--------- beginning of system
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
*** Service (starter) Create ***
/storage/emulated/0/Android/data/b4a.example/files/shared
true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 50 (Main)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at b4a.example.main._createfileprovideruri(main.java:459)
at b4a.example.main._button1_click(main.java:419)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6261)
at android.widget.TextView.performClick(TextView.java:11180)
at android.view.View$PerformClick.run(View.java:23748)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/b4a.example/files/shared/1.bal
at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:679)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:378)
... 23 more
** Activity (main) Pause, UserClosed = true **
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Should i?
YES. The old sdkmanager does not work anymore.
Create a NEW Folder and setup a new SDK There using the B4A SDKManager. Make sure to configure the IDE to use the new one.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Follow the instructions:

2. Android SDK
3. B4A
  • Download B4A Trial Version
  • Open B4A.
  • Choose Tools > Configure Paths.
  • Set the path to "javac.exe" if it is empty (C:\Program Files\Java\jdk1.8.0_102\bin\javac.exe).
  • Click on Open Sdk Manager button.
  • Set the path to "sdkmanager.bat" (C:\Android\tools\bin\sdkmanager.bat) and install all recommended items.
  • Read and accept the licenses when asked for.
  • Return to B4A and set the path to "android.jar" (C:\Android\platforms\android-27\android.jar).
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Is there a way to go back
no. The old SDK does not work anymore. It is mandatory to switch.

If you have any issue: create a new thread for it. Probably it is due to an mistake in your code (adding android-supporr-v4.jar using #additionaljar for example.
 
Upvote 0
Top