මොබයිල් ප්‍රශ්නයක්

HAneo

Well-known member
  • Jan 30, 2007
    12,970
    29,168
    113
    Homagama
    Android වැඩ කරුවනි.
    app දෙකක් අතර ඩේටා හුවමාරු කරගන්න විදිහක් කොමද? දැනට කරන්නේ ටෙක්ස්ට් ෆයිල් එකක සේව් කරලා එක රීඩ් කරලා ගන්න එක. API Endpoint ekakata කෝල් කරන්න බැ . එකත් API 30 වගේ එනකොට ෆයිල් ඇකසක් කරන්න හෙන අව්ලක් එනවා.
    මේ ඇප් එක පට්ට පරණ (API 24) වගේ ලෙවෙල් එකකට හදපු එකක්.

    පෙර අත්දැකීම් තියන එකෙක් හෙල්ප් එකක් දීපල්ලකෝ මේක ගොඩ දාගන්න
     

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,168
    113
    Homagama
    ekama phone ekeda app dekama thiyenne ?
    Yes
    Phone neme tab machan

    Do you need to do this in background?

    if not you can use sharesheet, app one opens the share sheet and select the second app. you can create your own file format as well.
    Machan refer karanna puluwan sample ekak nadda
    Thanks
    ------ Post added on Jan 11, 2024 at 7:07 PM

    Ubata oke code eka edit karanna puluwan Nan share sheet hari SQLite DB eheka data wage Nan content provider wage puluwan.
    Code eka open thiyanawa.
    UBa kiyanne
    ContentProvider class eka use karala karanna kiyana eka neda?
    Security Risk ekak thiyanawa kiyala eka reject kala ban
    ------ Post added on Jan 11, 2024 at 7:09 PM
     
    • Like
    Reactions: Solo Rider

    Solo Rider

    Well-known member
  • Sep 4, 2020
    35,924
    1
    157,342
    113
    98
    හෝමාගම
    Yes
    Phone neme tab machan


    Machan refer karanna puluwan sample ekak nadda
    Thanks
    ------ Post added on Jan 11, 2024 at 7:07 PM


    Code eka open thiyanawa.
    UBa kiyanne
    ContentProvider class eka use karala karanna kiyana eka neda?
    Security Risk ekak thiyanawa kiyala eka reject kala ban
    ------ Post added on Jan 11, 2024 at 7:09 PM

    Oya app 2kama ubalage neweyda ?
     
    • Love
    Reactions: HAneo

    Solo Rider

    Well-known member
  • Sep 4, 2020
    35,924
    1
    157,342
    113
    98
    හෝමාගම
    Yeah dekama ape sort of like
    ekak wena company ekaka. but change eka karanna puluwan


    ehenan loku case ekak ne ban

    permission denna one ekekin anikata data request karanne.
    eka hariyata path permission ekak wage.


    same certificate eken sign karanawa nan,
    adala permission request karannath puluwan known app ehekata witharay

    (mama security expert knowledege ekak nan ne ithin :sorry: )

    ay danne ne epa kiwe neda?
     

    coder101

    Well-known member
  • Jul 20, 2018
    333
    548
    93
    Math okata recommend kranne share sheet use kraneka.
    Check this mchn.
    https://developer.android.com/training/sharing/send

    ChatGPT is also suggesting the same to use the Intent system.

    I want to transfer text between 2 android apps developed by me. It is not possible to use API Endpoint calls. What are the available options to achieve this?

    -------------------------------

    If you want to transfer text between two Android apps developed by you without using API endpoint calls, you can explore several alternatives. Here are some options:
    1. Intent System:
      • You can use the Android Intent system to send data between activities or services in different apps.
      • Use Intent.putExtra() to include the text data in the intent and then start the target activity or service.
      • This is suitable for short strings of text.
    javaCopy code
    // Sending data from the first app Intent intent = newIntent("com.yourpackage.ACTION_TRANSFER_TEXT"); intent.putExtra("textData", "Your text data"); startActivity(intent);// Receiving data in the second app Intent intent = getIntent();String receivedText = intent.getStringExtra("textData");
    1. Content Provider:
      • Create a content provider in one app to share data, and the other app can access this provider to retrieve the text data.
      • This is more suitable for larger datasets or structured data.
    2. Broadcast Receiver:
      • You can use a broadcast receiver to send data from one app and receive it in another.
      • This is useful for one-way communication (app A sends data to app B, but not vice versa).
    3. File System:
      • Save the text data to a file in one app and read it in another app. You can use internal storage or external storage (if you have the necessary permissions).
      • Ensure proper handling of file permissions and security.
    4. SharedPreferences:
      • If the data is small and doesn't need to be persisted, you can use SharedPreferences to store and retrieve text data.
      • This is suitable for simple key-value pairs.
    javaCopy code
    // Save data in the first app SharedPreferences preferences =getSharedPreferences("MyPrefs", MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString("textData", "Your text data"); editor.apply(); // Retrieve data in the second app SharedPreferences preferences =getSharedPreferences("MyPrefs", MODE_PRIVATE); String receivedText =preferences.getString("textData", "");
    Choose the option that best fits your use case based on the size of the data, security considerations, and whether you need one-way or two-way communication between the apps.
    ------ Post added on Jan 11, 2024 at 11:18 PM
     
    • Love
    Reactions: HAneo

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,168
    113
    Homagama
    Math okata recommend kranne share sheet use kraneka.
    Check this mchn.
    https://developer.android.com/training/sharing/send

    ChatGPT is also suggesting the same to use the Intent system.

    I want to transfer text between 2 android apps developed by me. It is not possible to use API Endpoint calls. What are the available options to achieve this?

    -------------------------------

    If you want to transfer text between two Android apps developed by you without using API endpoint calls, you can explore several alternatives. Here are some options:
    1. Intent System:
      • You can use the Android Intent system to send data between activities or services in different apps.
      • Use Intent.putExtra() to include the text data in the intent and then start the target activity or service.
      • This is suitable for short strings of text.
    javaCopy code
    // Sending data from the first app Intent intent = newIntent("com.yourpackage.ACTION_TRANSFER_TEXT"); intent.putExtra("textData", "Your text data"); startActivity(intent);// Receiving data in the second app Intent intent = getIntent();String receivedText = intent.getStringExtra("textData");
    1. Content Provider:
      • Create a content provider in one app to share data, and the other app can access this provider to retrieve the text data.
      • This is more suitable for larger datasets or structured data.
    2. Broadcast Receiver:
      • You can use a broadcast receiver to send data from one app and receive it in another.
      • This is useful for one-way communication (app A sends data to app B, but not vice versa).
    3. File System:
      • Save the text data to a file in one app and read it in another app. You can use internal storage or external storage (if you have the necessary permissions).
      • Ensure proper handling of file permissions and security.
    4. SharedPreferences:
      • If the data is small and doesn't need to be persisted, you can use SharedPreferences to store and retrieve text data.
      • This is suitable for simple key-value pairs.
    javaCopy code
    // Save data in the first app SharedPreferences preferences =getSharedPreferences("MyPrefs", MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString("textData", "Your text data"); editor.apply(); // Retrieve data in the second app SharedPreferences preferences =getSharedPreferences("MyPrefs", MODE_PRIVATE); String receivedText =preferences.getString("textData", "");
    Choose the option that best fits your use case based on the size of the data, security considerations, and whether you need one-way or two-way communication between the apps.
    ------ Post added on Jan 11, 2024 at 11:18 PM
    THanks machan

    හරි මම මගේ වෙන දේ සරලව කියන්නම් කෝ
    පලවෙනි ඇප් එක අපේ එකක්. එකේ හැම 10 Sec ම සෙන්සර් 1200 කින් විතර එන ඩේටා තම දෙවෙනි ඇප් එකට පාස් කරන්න ඕනේ. 1200 උනාම key value පෙයාර් තමා මේ ඩේටා. ඔන්න ඕකට තමා විසදුමක් ඕනේ. මේ Sharesheet මෙතඩ් එක ඕකට පාවිච්චි කරන්න පුළුවන් නේද?

    @NEMISIS
    @coder101
    @Solo Rider
    ------ Post added on Jan 14, 2024 at 12:35 AM
     
    • Wow
    Reactions: Solo Rider

    Solo Rider

    Well-known member
  • Sep 4, 2020
    35,924
    1
    157,342
    113
    98
    හෝමාගම
    THanks machan


    හරි මම මගේ වෙන දේ සරලව කියන්නම් කෝ
    පලවෙනි ඇප් එක අපේ එකක්. එකේ හැම 10 Sec ම සෙන්සර් 1200 කින් විතර එන ඩේටා තම දෙවෙනි ඇප් එකට පාස් කරන්න ඕනේ. 1200 උනාම key value පෙයාර් තමා මේ ඩේටා. ඔන්න ඕකට තමා විසදුමක් ඕනේ. මේ Sharesheet මෙතඩ් එක ඕකට පාවිච්චි කරන්න පුළුවන් නේද?

    @NEMISIS
    @coder101
    @Solo Rider
    ------ Post added on



    Okata share sheet walata wada deyak ona wey ban.



    Oka manually eka parak karannada one nathnan first time receive wechcha gaman second eka listen Karan innawa wage ekakda wenna one?



    Ay data direct second app ekata ganne naththe? E part eka direct plug karanna barida
     
    • Love
    Reactions: HAneo

    HAneo

    Well-known member
  • Jan 30, 2007
    12,970
    29,168
    113
    Homagama
    Okata share sheet walata wada deyak ona wey ban.



    Oka manually eka parak karannada one nathnan first time receive wechcha gaman second eka listen Karan innawa wage ekakda wenna one?



    Ay data direct second app ekata ganne naththe? E part eka direct plug karanna barida
    Na machan meka one time
    anik app ekata data tika dunna nam iwarayi