JP2022131859A - Printing control device, printing control method and program for printing - Google Patents

Printing control device, printing control method and program for printing Download PDF

Info

Publication number
JP2022131859A
JP2022131859A JP2021031046A JP2021031046A JP2022131859A JP 2022131859 A JP2022131859 A JP 2022131859A JP 2021031046 A JP2021031046 A JP 2021031046A JP 2021031046 A JP2021031046 A JP 2021031046A JP 2022131859 A JP2022131859 A JP 2022131859A
Authority
JP
Japan
Prior art keywords
application
printing
activity
print data
print
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2021031046A
Other languages
Japanese (ja)
Inventor
大貴 伊藤
Daiki Ito
啓介 五十嵐
Keisuke Igarashi
裕一 松下
Yuichi Matsushita
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Star Micronics Co Ltd
Original Assignee
Star Micronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Star Micronics Co Ltd filed Critical Star Micronics Co Ltd
Priority to JP2021031046A priority Critical patent/JP2022131859A/en
Publication of JP2022131859A publication Critical patent/JP2022131859A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Accessory Devices And Overall Control Thereof (AREA)

Abstract

To provide a printing control device and method and a program for printing for preventing the occurrence of erroneous printing such as double printing when an application for printing is started while the application for printing exists in the background and activities are destructed.SOLUTION: A printing control device comprises: a destruction assessment unit 103 for assessing, when an activity is generated by onCreate at startup of an application for printing, whether or not the activity of the application for printing is in a destructed state before that; and a printing control unit 104 for performing control not to execute the processing of print data acquired in onCreate when it is assessed that the activity is in a destructed state. Even when the same activity as the destructed activity is regenerated by onCreate, the processing of print data acquired in onCreate in association with that is not executed and processing of only print data acquired by an argument to onNewIntent is executed.SELECTED DRAWING: Figure 2

Description

本発明は、印刷制御装置、印刷制御方法および印刷用プログラムに関し、特に、ホスト端末からプリンタにデータを送信して印刷を行うようになされたシステムにおける印刷の実行を制御する技術に関するものである。 The present invention relates to a print control device, a print control method, and a print program, and more particularly to technology for controlling execution of printing in a system in which data is sent from a host terminal to a printer for printing.

従来、URLスキームまたはインテント連携と称されるアプリ連携コマンドを利用してホスト端末として機能する、スマートフォンやタブレット端末などの携帯端末を含むスマートデバイスにおいて、フォアグラウンドで動作中のアプリケーション(以下、使用中アプリという)から印刷用アプリケーション(以下、印刷用アプリと略す)を起動することにより、ホスト端末からプリンタに印刷データを送信して印刷を行うことができるようになされた技術が提供されている。この他、スマートデバイスとして据え置き型のスマートデバイス等印刷用アプリが動作するものであれば、ホスト端末として使用可能である。 Conventionally, applications running in the foreground (hereinafter referred to as in-use A technology has been provided in which printing can be performed by sending print data from a host terminal to a printer by activating a printing application (hereinafter referred to as a printing application) from a host terminal. In addition, any smart device that can run a printing application, such as a stationary smart device, can be used as a host terminal.

この種の技術を利用したシステムにおいて、フォアグラウンドで動作中の使用中アプリは、HTML(HyperText Markup Language)またはPDF(Portable Document Format)などの形式で印刷データを生成すると、アプリ連携コマンドを利用して印刷用アプリを起動する。その際、使用中アプリは、印刷データまたは印刷データへアクセスするためのURLをアプリ連携コマンドに付与する。続いて、アプリ連携コマンドによって起動された印刷用アプリは、その起動時に使用中アプリがアプリ連携コマンドに付与した印刷データを読み取る。そして、読み取った印刷データをプリンタ用コマンドに変換してプリンタに送信することにより、印刷を実行する。 In a system using this type of technology, an application in use running in the foreground generates print data in a format such as HTML (HyperText Markup Language) or PDF (Portable Document Format), and uses an application cooperation command. Start the printing application. At that time, the application in use gives the print data or a URL for accessing the print data to the application cooperation command. Subsequently, the printing application activated by the application cooperation command reads the print data given to the application cooperation command by the application in use at the time of activation. Then, the read print data is converted into a printer command and transmitted to the printer to execute printing.

ところで、Android(登録商標)OS上で動作するアプリケーション(以下、Androidアプリという)は、アクティビティという単位で画面が管理されている。Androidアプリは複数のアクティビティを持つことが可能であり、どれか1つのアクティビティがメインアクティビティとして指定される。このメインアクティビティが、アプリ起動時に表示されるアクティビティ(画面)となる。 By the way, in an application that runs on the Android (registered trademark) OS (hereinafter referred to as an Android application), the screen is managed in units called activities. An Android application can have multiple activities, one of which is designated as the main activity. This main activity becomes the activity (screen) displayed when the application is started.

Androidアプリが有するアクティビティの管理機能の1つとして、アクティビティを生成する際に、既に同じアクティビティが存在する場合は新規に生成せず、既存のアクティビティを再利用するという機能が存在する。例えば、複数のアプリケーションが起動されている場合においてメモリ不足が生じたときに、画面の最前面に存在しないアプリケーションが一時的にメモリを解放することがある。このメモリ開放の際にはアクティビティが内部的に一度破棄されるが、画面の復帰時には同じアクティビティが再生成される。 As one of the activity management functions of an Android application, when creating an activity, if the same activity already exists, a new activity is not created and the existing activity is reused. For example, when a memory shortage occurs while multiple applications are running, an application that is not in the foreground of the screen may temporarily release the memory. When the memory is released, the activity is internally discarded once, but the same activity is recreated when the screen is restored.

アプリ連携コマンドによって起動される印刷用アプリは、起動時にバックグラウンドに存在しているか否かに応じて、以下のように実行される。すなわち、印刷用アプリがバックグラウンドに存在していない状態でアプリ連携コマンドにより起動された場合は、印刷用アプリのアクティビティがonCreateというコールバックメソッド(以下、単にメソッドという)により新規に生成される。アプリ連携コマンドに付与された印刷データは、onCreate内でアクティビティが保持するIntentを利用して取得される(以下、単に「onCreate内で取得」ということがある)。一方、印刷用アプリが既にバックグラウンドに存在している状態でアプリ連携コマンドにより起動された場合は、新規にアクティビティの生成は行われず、既存のアクティビティを再利用するためonNewIntentというメソッドが呼ばれる。アプリ連携コマンドに付与された印刷データはonNewIntentの引数で付与されるIntentを利用して取得される(以下、単に「onNewIntentの引数で取得」ということがある)。なお上記Intentとは様々な情報が入る入れ物であり、別のアクティビティを起動する際の情報受け渡しや情報の格納などに利用される。
The printing application activated by the application cooperation command is executed as follows depending on whether it exists in the background at the time of activation. That is, when the printing application is not in the background and is started by the application cooperation command, the activity of the printing application is newly created by the callback method onCreate (hereinafter simply referred to as the method). The print data assigned to the application link command is acquired using the Intent held by the activity in onCreate (hereinafter sometimes simply referred to as "acquired in onCreate"). On the other hand, if the printing app is already in the background and is launched by the app link command, a new activity will not be created, and the onNewIntent method will be called to reuse the existing activity. The print data given to the application link command is obtained using the Intent given by the argument of onNewIntent (hereinafter sometimes simply referred to as "obtained by the argument of onNewIntent"). Note that the above Intent is a container that contains various information, and is used for information transfer and information storage when another activity is started.

ここで、印刷用アプリが既にバックグラウンドに存在し、かつ、アクティビティが内部的に破棄された状態で、印刷用アプリがアプリ連携コマンドにより起動される場合がある。この場合は、既存のアクティビティを再利用するためonNewIntentが呼ばれ、印刷データがonNewIntentの引数で取得されるとともに、破棄されたアクティビティと同じアクティビティが再生成される。このとき、アクティビティが保持していたIntentも再生成される。そのため、破棄される前の印刷データがアクティビティが保持するIntentとして残っていると、その古い印刷データが、再生成されたアクティビティのonCreate内で取得できる。 Here, in a state where the printing application already exists in the background and the activity has been internally discarded, the printing application may be activated by the application cooperation command. In this case, onNewIntent is called to reuse the existing activity, the print data is obtained as an argument of onNewIntent, and the same activity that was destroyed is recreated. At this time, the intent held by the activity is also regenerated. Therefore, if the print data before being discarded remains as an intent held by the activity, the old print data can be obtained in onCreate of the regenerated activity.

このため、再生成されたアクティビティのonCreate内でアクティビティが保持するIntentから取得された古い印刷データと、onNewIntentの引数で付与されるIntentから取得された新しい印刷データとに基づいて二重に印刷が行われてしまうことがあるという問題があった。また、使用中アプリから送られるアプリ連携コマンドによる印刷用アプリの起動が行われていないときでも、AndroidOSによって印刷用アプリのバックグラウンドからの復帰が行われることがあると(例えば、画面ロック状態の解除時など)、再生成されたアクティビティのonCreate内でアクティビティが保持するIntentから取得される古い印刷データに基づいて印刷が実行されてしまうことがあるという問題もあった。 For this reason, double printing is performed based on the old print data obtained from the Intent held by the activity in onCreate of the regenerated activity and the new print data obtained from the Intent given by the onNewIntent argument. There was a problem that it could be done. Also, even when the printing application is not started by the application cooperation command sent from the application in use, if the Android OS may resume the printing application from the background (for example, if the screen is locked) There was also a problem that printing was executed based on the old print data obtained from the Intent held by the activity in onCreate of the regenerated activity.

なお、従来、あるタイミングでサーバから取得した画像情報と、それ以前にそのサーバから取得した画像情報との間に差異があるか否かを判断し、差異があると判断した場合に、その新たに取得した画像情報に基づいて画像を形成するようにしたプリンタが知られている(例えば、特許文献1参照)。また、URL情報に基づいてウェブサイトより取得したウェブリソースから更新の有無を判断し、取得済データを更新し、更新した取得済データから印刷データを生成することにより、無駄な印刷をしてしまう可能性を軽減することを可能にしたプリンタも知られている(例えば、特許文献2参照)。 Conventionally, it is determined whether or not there is a difference between the image information obtained from the server at a certain timing and the image information obtained from the server before that time. There is known a printer that forms an image based on image information acquired in the first step (see, for example, Japanese Unexamined Patent Application Publication No. 2002-100003). In addition, by determining whether there is an update from the web resource acquired from the website based on the URL information, updating the acquired data, and generating print data from the updated acquired data, wasteful printing is performed. Printers are also known that make it possible to mitigate the possibility (see, for example, US Pat.

これら特許文献1,2に記載の技術を用いて、再生成されたアクティビティのonCreate内でアクティビティが保持するIntentから取得された古い印刷データと、onNewIntentの引数で付与されるIntentから取得された新しい印刷データとを比較して差異または更新の有無を判定し、差異または更新がある場合に、onNewIntentの引数で付与されるIntentから取得された新しい印刷データだけを用いて印刷を実行するようにすることが考えられる。しかしながら、この場合、古い印刷データと新しい印刷データとを比較するという負荷のかかる処理を実行しなければならないという問題がある。また、onNewIntentの引数で付与されるIntentから取得された新しい印刷データが存在しない場合に、onCreate内でアクティビティが保持するIntentから取得された古い印刷データだけが印刷されてしまうという問題を解消することはできない。 Using the techniques described in Patent Documents 1 and 2, the old print data obtained from the Intent held by the activity in onCreate of the regenerated activity and the new print data obtained from the Intent given by the onNewIntent argument Compare it with the print data to determine if there is a difference or update, and if there is a difference or update, print using only the new print data obtained from the Intent given in the argument of onNewIntent. can be considered. However, in this case, there is a problem that it is necessary to perform a load-intensive process of comparing old print data and new print data. Also, if there is no new print data obtained from the Intent given in the argument of onNewIntent, solve the problem that only the old print data obtained from the Intent held by the activity in onCreate is printed. can't.

特許第4006121号公報Japanese Patent No. 4006121 特許第5042142号公報Japanese Patent No. 5042142

本発明は、このような問題を解決するために成されたものであり、印刷用アプリがバックグラウンドに存在し、かつ、アクティビティが内部的に破棄された状態で印刷用アプリが起動される場合に、古い印刷データと新しい印刷データとに基づいて二重に印刷が行われたり、古い印刷データに基づいて印刷が行われたりするといった誤印刷を防止できるようにすることを目的とする。 The present invention has been made to solve this problem. Another object of the present invention is to prevent erroneous printing such as double printing based on old print data and new print data, or printing based on old print data.

上記した課題を解決するために、本発明では、印刷用アプリ30の起動時にアクティビティが生成された場合、それより前に印刷用アプリのアクティビティが破棄された状態であるか否かを判定し、アクティビティが破棄された状態であると判定された場合には、破棄されたアクティビティを再利用するために再生成されたアクティビティに関連して取得される印刷データの処理を実行しないようにしている。 In order to solve the above-described problem, in the present invention, when an activity is generated when the printing application 30 is activated, it is determined whether or not the activity of the printing application has been discarded before that, When it is determined that the activity is in a discarded state, processing of print data acquired in relation to the regenerated activity is not executed in order to reuse the discarded activity.

上記のように構成した本発明によれば、印刷用アプリがバックグラウンドに存在し、かつ、アクティビティが内部的に破棄された状態で、印刷用アプリがアプリ連携コマンドにより起動された場合、破棄されたアクティビティと同じアクティビティが再生成されたとしても、それに関連して取得される印刷データの処理は実行されることがなくなる。これにより、古い印刷データと新しい印刷データとに基づいて二重に印刷が行われたり、古い印刷データに基づいて印刷が行われたりするといった誤印刷を防止することができる。 According to the present invention configured as described above, when the printing application exists in the background and the activity is internally discarded, and the printing application is started by the application cooperation command, the printing application is discarded. Even if the same activity as the activity that was created is regenerated, the processing of the print data acquired in relation to it will not be executed. This makes it possible to prevent erroneous printing, such as double printing based on old print data and new print data, or printing based on old print data.

本実施形態の印刷制御装置を適用した印刷システムの全体構成例を示す図である。1 is a diagram illustrating an example of the overall configuration of a printing system to which a print control device of this embodiment is applied; FIG. 本実施形態による印刷制御装置の機能構成例を示すブロック図である。2 is a block diagram showing an example functional configuration of a print control apparatus according to the embodiment; FIG. 本実施形態による印刷制御装置を含む携帯端末の動作例を示すフローチャートである。4 is a flow chart showing an operation example of a mobile terminal including the print control device according to the embodiment; 本実施形態による印刷制御装置を含む携帯端末の動作例を示すフローチャートである。4 is a flow chart showing an operation example of a mobile terminal including the print control device according to the embodiment; 本実施形態による印刷制御装置を含む携帯端末の動作例を示すフローチャートである。4 is a flow chart showing an operation example of a mobile terminal including the print control device according to the embodiment; 本実施形態による印刷制御装置を含む携帯端末の動作例を示すフローチャートである。4 is a flow chart showing an operation example of a mobile terminal including the print control device according to the embodiment; 本実施形態による印刷制御装置の他の機能構成例を示すブロック図である。FIG. 5 is a block diagram showing another functional configuration example of the print control apparatus according to the embodiment; 本実施形態による印刷制御装置の他の機能構成例を示すブロック図である。FIG. 5 is a block diagram showing another functional configuration example of the print control apparatus according to the embodiment;

以下、本発明の一実施形態を図面に基づいて説明する。図1は、本実施形態の印刷制御装置を適用した印刷システムの全体構成例を示す図である。図1に示すように、本実施形態の印刷システムは、携帯端末100およびプリンタ200を備えて構成されている。携帯端末100は、アプリ連携コマンドを利用してプリンタ200に印刷を実行させる機能を有するホスト端末の一例であり、例えば、スマートフォンまたはタブレット端末である。この他、スマートデバイスとして据え置き型のスマートデバイス等印刷用アプリが動作するものであれば、ホスト端末として使用可能である。携帯端末100およびプリンタ200は、Wi-Fi(登録商標)またはBluetooth(登録商標)またはBluetooth Low Energy、USBによる無線または有線通信機能を有しており、双方向に通信を行うことができるようになっている。 An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a diagram showing an example of the overall configuration of a printing system to which the printing control device of this embodiment is applied. As shown in FIG. 1, the printing system of this embodiment includes a mobile terminal 100 and a printer 200 . The mobile terminal 100 is an example of a host terminal having a function of causing the printer 200 to execute printing using an application cooperation command, and is, for example, a smart phone or a tablet terminal. In addition, any smart device that can run a printing application, such as a stationary smart device, can be used as a host terminal. The mobile terminal 100 and the printer 200 have wireless or wired communication functions by Wi-Fi (registered trademark), Bluetooth (registered trademark), Bluetooth Low Energy, or USB, and are capable of two-way communication. It's becoming

携帯端末100には、アプリ連携機能を有するオペレーティングシステム(OS)10と、HTML形式、PDF形式、その他の所定の形式で印刷データを生成する機能を有するアプリケーションである印刷データ生成用アプリ20と、印刷制御用のアプリケーションである印刷用アプリ30とがインストールされている。印刷用アプリ30は、フォアグラウンドで使用されている印刷データ生成用アプリ20(以下、使用中アプリ20という)で生成された印刷データを、プリンタ200が理解できるプリンタ用コマンドに変換してプリンタ200に送信することにより、印刷処理を実行する。 The mobile terminal 100 includes an operating system (OS) 10 having an application cooperation function, a print data generation application 20 which is an application having a function of generating print data in a predetermined format such as HTML format, PDF format, etc. A print application 30, which is an application for print control, is installed. The print application 30 converts the print data generated by the print data generation application 20 used in the foreground (hereinafter referred to as the in-use application 20) into printer commands that the printer 200 can understand, and sends them to the printer 200. By sending it, print processing is executed.

OS10は、AndroidOSであり、当該OS10上で動作する使用中アプリ20および印刷用アプリ30は何れも、アクティビティという単位で画面が管理されている。本実施形態では、ユーザが使用中アプリ20をフォアグラウンドで使用しているとき(使用中アプリ20のアクティビティ(画面)が最前面に表示されているとき)に、アプリ連携コマンドによって印刷用アプリ30を起動し、使用中アプリ20で生成された印刷データを印刷用アプリ30に受け渡すことにより、印刷を実行する。 The OS 10 is an Android OS, and the screens of the in-use application 20 and the printing application 30 that operate on the OS 10 are managed in units of activities. In this embodiment, when the user is using the application 20 in use in the foreground (when the activity (screen) of the application 20 in use is displayed in the foreground), the printing application 30 is activated by the application cooperation command. Printing is executed by starting up and transferring print data generated by the application 20 in use to the printing application 30 .

すなわち、フォアグラウンドで動作中の使用中アプリ20は、HTMLまたはPDFなどの形式で印刷データを生成すると、アプリ連携コマンドを利用して印刷用アプリ30を起動する。その際、使用中アプリ20は、印刷データまたは印刷データへアクセスするためのURLをアプリ連携コマンドに付与する。続いて、アプリ連携コマンドによって起動された印刷用アプリ30は、その起動時に使用中アプリ20がアプリ連携コマンドに付与した印刷データを読み取る。そして、読み取った印刷データをプリンタ用コマンドに変換してプリンタ200に送信することにより、印刷を実行する。 That is, when the in-use application 20 running in the foreground generates print data in a format such as HTML or PDF, it activates the printing application 30 using the application cooperation command. At that time, the application 20 in use gives the print data or a URL for accessing the print data to the application cooperation command. Subsequently, the printing application 30 activated by the application cooperation command reads the print data added to the application cooperation command by the in-use application 20 at the time of its activation. Then, the read print data is converted into a printer command and transmitted to the printer 200 to execute printing.

ここで、印刷用アプリ30の起動に関しては、印刷用アプリ30がバックグラウンドに存在していない状態でアプリ連携コマンドによって起動される場合と、バックグラウンドに存在している状態でアプリ連携コマンドによって起動される場合とがある。バックグラウンドに存在している状態で起動される場合は更に、印刷用アプリ30のアクティビティが破棄されていない状態で起動される場合と、内部的に破棄された状態で起動される場合とがある。アクティビティの破棄は、例えば、印刷用アプリ30がバックグラウンドに存在しているときに、システムの制約(構成の変更やメモリ負荷など)が原因で、行わることがある。その際、OS10にはこのアクティビティが存在したことが記憶される。印刷用アプリ30がこのアクティビティを起動しようとすると、前述の記憶された情報を利用してアクティビティの再生成を行う。印刷用アプリ30は、これら3つの何れの状態で起動されたかによって、以下のように異なる動作を実行する。 Here, regarding the activation of the printing application 30, the printing application 30 may be activated by the application cooperation command while the printing application 30 does not exist in the background, or may be activated by the application cooperation command while the printing application 30 exists in the background. There are cases where it is done. When the activity of the printing application 30 is activated while existing in the background, it may be activated in a state in which the activity of the printing application 30 has not been discarded, or may be activated in a state in which it has been internally discarded. . An activity may be discarded, for example, due to system restrictions (configuration change, memory load, etc.) while the printing application 30 is in the background. At that time, the OS 10 stores that this activity exists. When the printing application 30 attempts to start this activity, it regenerates the activity using the above-described stored information. The printing application 30 performs different operations as follows depending on which of these three states it is activated.

印刷用アプリ30がバックグラウンドに存在していない状態で、アプリ連携コマンドにより印刷用アプリ30が起動された場合、印刷用アプリ30のアクティビティはOS10によりコールされたonCreateのメソッドによって新規に生成される。印刷用アプリ30は、アプリ連携コマンドに付与された印刷データを、当該onCreate内でアクティビティが保持するIntentを利用して取得する。そして、取得した印刷データをプリンタ用コマンドに変換してプリンタ200に送信することにより、印刷を実行する。なお、印刷用アプリ30がバックグラウンドに存在していない状態は、例として新規に印刷用アプリ30をインストールした直後の状態や、携帯端末100を起動後、印刷用アプリ30が全く起動していない状態において初めて印刷用アプリ30を起動した状態や、それに近い状態で印刷用アプリ30がOS10に起動されていない状態等があげられる。 When the printing application 30 is activated by an application cooperation command while the printing application 30 does not exist in the background, the activity of the printing application 30 is newly generated by the onCreate method called by the OS 10. . The printing application 30 acquires the print data attached to the application cooperation command by using the Intent held by the activity in the onCreate. Then, by converting the acquired print data into a printer command and transmitting the command to the printer 200, printing is executed. Note that the state in which the printing application 30 does not exist in the background is, for example, the state immediately after the printing application 30 is newly installed, or the state in which the printing application 30 is not started at all after the mobile terminal 100 is started. The state includes a state in which the printing application 30 is activated for the first time, a state similar to that in which the printing application 30 is not activated by the OS 10, and the like.

印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄されていない状態のときに、アプリ連携コマンドにより印刷用アプリ30が起動された場合、新規にアクティビティの生成は行われず、既存のアクティビティを再利用するためonNewIntentのメソッドがOS10によりコールされる。印刷用アプリ30は、アプリ連携コマンドに付与された印刷データを、当該onNewIntentの引数で付与されるIntentを利用して取得する。そして、取得した印刷データをプリンタ用コマンドに変換してプリンタ200に送信することにより、印刷を実行する。 When the printing application 30 exists in the background and the activity of the printing application 30 is not discarded, and the printing application 30 is activated by an application cooperation command, a new activity is generated. is not performed, and the method of onNewIntent is called by the OS 10 to reuse the existing activity. The printing application 30 acquires the print data attached to the application cooperation command by using the Intent attached as the argument of the onNewIntent. Then, by converting the acquired print data into a printer command and transmitting the command to the printer 200, printing is executed.

印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄された状態のとき、アプリ連携コマンドにより印刷用アプリ30が起動された場合、既存のアクティビティを再利用するためonNewIntentのメソッドがOS10によりコールされる。印刷用アプリ30は、アプリ連携コマンドに付与された印刷データを、当該onNewIntentの引数で付与されるIntentを利用して取得する。そして、取得した印刷データをプリンタ用コマンドに変換してプリンタ200に送信することにより、印刷を実行する。 When the printing application 30 exists in the background and the activity of the printing application 30 is discarded, the existing activity is reused when the printing application 30 is started by an application cooperation command. Therefore, the onNewIntent method is called by the OS 10 . The printing application 30 acquires the print data attached to the application cooperation command by using the Intent attached as the argument of the onNewIntent. Then, by converting the acquired print data into a printer command and transmitting the command to the printer 200, printing is executed.

この印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄された状態は、例として携帯端末100に搭載される実行領域が少ない機種等において他のアプリを多く起動している場合、バックグラウンドに存在しているアプリの実行領域を解放してしまうため、このような現象が起こると考えられる。さらに省エネ機能の搭載された機種等の場合においても、消費電力を抑えるためにバックグラウンドに存在しているアプリの機能や実行領域を制限することが想定されるため、アクティビティが破棄された状態が起こると考えられる。 In a state where the printing application 30 exists in the background and the activity of the printing application 30 is discarded, for example, in a model with a small execution area installed in the mobile terminal 100, many other applications can be used. It is thought that such a phenomenon occurs because the execution area of the application that exists in the background is released when it is running. Furthermore, even in the case of models equipped with energy saving functions, it is assumed that the functions and execution areas of apps that exist in the background will be restricted in order to reduce power consumption. thought to occur.

また、アクティビティが破棄された状態での起動であるため、破棄されたアクティビティと同じアクティビティがonCreateによって再生成される。このとき、アクティビティが保持していたIntentも再生成される。そのため、破棄される前の古い印刷データがアクティビティが保持するIntentとして残っていると、印刷用アプリ30は、再生成されたアクティビティのonCreate内でその古い印刷データを取得してプリンタ用コマンドに変換しようとする。ただし、本実施形態では、以下に詳しく説明するように、このように再生成されたアクティビティのonCreate内で取得される印刷データはプリンタ用コマンドに変換せず、印刷が実行されないように制御する。 Also, since the activity is started with the activity destroyed, the same activity as the destroyed activity is recreated by onCreate. At this time, the intent held by the activity is also regenerated. Therefore, if old print data before being discarded remains as an intent held by the activity, the printing application 30 acquires the old print data in onCreate of the regenerated activity and converts it to a printer command. try to. However, in this embodiment, as will be described in detail below, the print data acquired in onCreate of the regenerated activity is not converted into a printer command and controlled so that printing is not executed.

図2は、携帯端末100に実装される本実施形態による印刷制御装置の機能構成例を示すブロック図である。図2に示すように、本実施形態の印刷制御装置は、印刷用アプリ30により実装される機能構成として、印刷データ取得部101、コマンド変換部102、破棄判定部103、印刷制御部104および情報記録部105を備えている。また、本実施形態の印刷制御装置(携帯端末100)は、記憶媒体として情報記憶部106を備えている。 FIG. 2 is a block diagram showing a functional configuration example of the print control apparatus according to the present embodiment implemented in the mobile terminal 100. As shown in FIG. As shown in FIG. 2, the print control apparatus of the present embodiment includes a print data acquisition unit 101, a command conversion unit 102, a discard determination unit 103, a print control unit 104, and an information A recording unit 105 is provided. Further, the print control apparatus (portable terminal 100) of this embodiment includes an information storage unit 106 as a storage medium.

上記各機能ブロック101~105は、ハードウェア、DSP(Digital Signal Processor)、ソフトウェアの何れによっても構成することが可能である。例えばソフトウェアによって構成する場合、上記各機能ブロック101~105は、実際にはコンピュータのCPU、RAM、ROMなどを備えて構成され、RAMやROM、ハードディスクまたは半導体メモリ等の記憶媒体に記憶された印刷用アプリ30のプログラムが動作することによって実現される。 Each of the functional blocks 101 to 105 can be configured by hardware, DSP (Digital Signal Processor), or software. For example, when configured by software, the functional blocks 101 to 105 are actually configured with a computer CPU, RAM, ROM, etc., and print data stored in a storage medium such as RAM, ROM, hard disk, or semiconductor memory. It is realized by running the program of the application 30 for the application.

印刷データ取得部101は、使用中アプリ20から発行されるアプリ連携コマンドに付与されている印刷データを取得する。印刷データ取得部101は、OS10によりonCreateがコールされた場合は、当該onCreate内でアクティビティが保持するIntentを利用して印刷データを取得する。ここで、onCreateによりアクティビティが新規生成される場合も、アクティビティが一度破棄された後に再生成される場合も、印刷データ取得部101はonCreate内で印刷データを取得する。一方、印刷データ取得部101は、OS10によりonNewIntentがコールされた場合は、当該onNewIntentの引数で付与されるIntentを利用して印刷データを取得する。印刷データ取得部101は、取得した印刷データをコマンド変換部102に供給する。 The print data acquisition unit 101 acquires print data attached to the application cooperation command issued by the application 20 in use. When onCreate is called by the OS 10, the print data acquisition unit 101 acquires print data using the Intent held by the activity in onCreate. Here, the print data acquisition unit 101 acquires the print data in onCreate regardless of whether the activity is newly generated by onCreate or when the activity is regenerated after being discarded once. On the other hand, when onNewIntent is called by the OS 10, the print data acquisition unit 101 acquires print data using the Intent given as an argument of the onNewIntent. The print data acquisition unit 101 supplies the acquired print data to the command conversion unit 102 .

コマンド変換部102は、印刷データ取得部101から供給された印刷データをプリンタ用コマンドに変換し、プリンタ200に送信する。 The command conversion unit 102 converts the print data supplied from the print data acquisition unit 101 into printer commands, and transmits the commands to the printer 200 .

破棄判定部103は、使用中アプリ20から発行されるアプリ連携コマンドによる印刷用アプリ30の起動時に、アクティビティが生成された場合(アクティビティが新規生成された場合およびアクティビティが一度破棄された後に再生成された場合の両方を含む)、すなわち、印刷データ取得部101がonCreate内でアクティビティが保持するIntentを利用して印刷データを取得した場合に、それより前に印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する。この破棄判定部103による判定の結果は、印刷制御部104による印刷の制御に利用される。なお、破棄判定部103による判定方法の具体的な内容については後述する。 The discard determination unit 103 determines whether an activity is generated when the printing application 30 is activated by an application cooperation command issued by the in-use application 20 (when an activity is newly generated or when an activity is regenerated after being discarded once). ), that is, when the print data acquisition unit 101 acquires the print data using the Intent held by the activity in onCreate, the activity of the print application 30 is discarded before that. It is determined whether or not the The determination result of the discard determination unit 103 is used for printing control by the print control unit 104 . Details of the determination method by the discard determination unit 103 will be described later.

印刷制御部104は、プリンタ200に対する印刷の実行を制御する。ここで、印刷制御部104は、(1)印刷用アプリ30がバックグラウンドに存在していない状態で起動された場合、(2)印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄されていない状態で起動された場合、(3)印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄された状態で起動された場合の3つのケースに応じて、プリンタ200に対する印刷の実行を制御する。(1)のケースと(3)のケースは、印刷データ取得部101がonCreate内でアクティビティが保持するIntentを利用して印刷データを取得するケースである。(1)と(3)のどちらのケースに該当するかが破棄判定部103により判定される。これに対して(2)のケースは、印刷データ取得部101がonNewIntentの引数で付与されるIntentを利用して印刷データを取得するケースである。 The print control unit 104 controls execution of printing by the printer 200 . Here, the print control unit 104 determines (1) when the printing application 30 is started in a state where the printing application 30 does not exist in the background, and (2) when the printing application 30 exists in the background and the printing (3) the printing application 30 exists in the background and the activity of the printing application 30 has been discarded; Execution of printing to the printer 200 is controlled according to three cases. Cases (1) and (3) are cases in which the print data acquisition unit 101 acquires print data using the Intent held by the activity in onCreate. The discard determination unit 103 determines which case (1) or (3) applies. On the other hand, case (2) is a case where the print data acquisition unit 101 acquires print data using an Intent given as an argument of onNewIntent.

すなわち、印刷用アプリ30がバックグラウンドに存在していない状態で起動された場合(上記(1)のケース)、印刷制御部104は、そのことを破棄判定部103による判定の結果に基づいて検知する。この場合、印刷制御部104は、印刷データ取得部101によりonCreate内でアクティビティが保持するIntentを利用して取得された印刷データをコマンド変換部102に供給し、印刷データのコマンド変換処理を実行するように制御する。 That is, when the printing application 30 is activated without being in the background (case (1) above), the print control unit 104 detects this based on the determination result of the discard determination unit 103. do. In this case, the print control unit 104 supplies the print data acquired by the print data acquisition unit 101 using the intent held by the activity in onCreate to the command conversion unit 102, and executes command conversion processing of the print data. to control.

また、印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄されていない状態で起動された場合(上記(2)のケース)、印刷制御部104は、印刷データ取得部101によりonNewIntentの引数で付与されるIntentを利用して取得された印刷データをコマンド変換部102に供給し、印刷データのコマンド変換処理を実行するように制御する。このケースの場合、onCreate内でアクティビティが保持するIntentを利用した印刷データの取得が行われないので、破棄判定部103による判定の結果を利用する必要はない。 Further, when the printing application 30 exists in the background and is activated in a state where the activity of the printing application 30 has not been discarded (case (2) above), the printing control unit 104 causes the printing The print data acquired by the data acquisition unit 101 using the Intent given by the argument of onNewIntent is supplied to the command conversion unit 102, and the command conversion processing of the print data is executed. In this case, print data is not acquired using the Intent held by the activity in onCreate, so there is no need to use the determination result of the discard determination unit 103 .

また、印刷用アプリ30がバックグラウンドに存在していて、かつ、印刷用アプリ30のアクティビティが破棄された状態で起動された場合(上記(3)のケース)、印刷制御部104は、そのことを破棄判定部103による判定の結果に基づいて検知する。この場合、印刷制御部104は、印刷データ取得部101によりonNewIntentの引数で取得された印刷データをコマンド変換部102に供給し、当該印刷データのコマンド変換処理を実行するように制御する一方で、破棄されたアクティビティを再利用するためにonCreateにより再生成されたアクティビティに関連して当該onCreate内で取得された印刷データはコマンド変換部102に供給せず、当該印刷データのコマンド変換処理を実行しないように制御する。 Further, when the printing application 30 exists in the background and is started with the activity of the printing application 30 discarded (case (3) above), the printing control unit 104 is detected based on the determination result of the discard determination unit 103 . In this case, the print control unit 104 supplies the print data acquired by the print data acquisition unit 101 with the argument of onNewIntent to the command conversion unit 102, and performs command conversion processing for the print data. The print data acquired in onCreate in relation to the activity regenerated by onCreate in order to reuse the discarded activity is not supplied to the command conversion unit 102, and the command conversion processing of the print data is not executed. to control.

従来は、OS10によりonCreateがコールされた際に、それが(1)のケースのように印刷用アプリ30がバックグラウンドに存在していない状態で起動されたことに起因してコールされたのか、(3)のケースのように印刷用アプリ30がバックグラウンドに存在していながらアクティビティが破棄された状態で起動されたことに起因してコールされたのかを判別する手段を持っていなかった。そのために、古い印刷データと新しい印刷データとに基づいて二重に印刷が行われるといった誤印刷が発生することがあった。これに対して、本実施形態では、(1)のケースでonCreateがコールされたのか、(3)のケースでonCreateがコールされたのかを判別する手段として破棄判定部103を設け、(3)のケースでonCreateがコールされたと判定される場合には、onCreateにより再生成されたアクティビティに関連して取得される印刷データの処理を実行しないように制御している。 Conventionally, when onCreate was called by the OS 10, was it called because the printing application 30 was not in the background as in case (1)? As in the case of (3), there was no means for determining whether a call was made because the print application 30 existed in the background and was started in a state where the activity was abandoned. As a result, erroneous printing, such as double printing based on old print data and new print data, may occur. On the other hand, in this embodiment, the discard determination unit 103 is provided as means for determining whether onCreate is called in case (1) or whether onCreate is called in case (3). If it is determined that onCreate has been called in the above case, it is controlled not to process the print data acquired in relation to the activity regenerated by onCreate.

情報記録部105は、印刷用アプリ30がフォアグラウンドからバックグラウンドに移行する際に、アクティビティが破棄された後にそれと同じアクティビティの再生成を行う際に必要となる情報を情報記憶部106に一時的に保存する。例えば、この情報記憶部106として、onSavedInstanceと呼ばれるインスタンスを用いることが可能である。印刷用アプリ30が全く起動されていない状態(フォアグラウンドにもバックグラウンドにも存在しない状態の場合)では、情報記憶部106にはNull値が記憶されている。その状態から印刷用アプリ30が起動されてフォアグラウンドに存在する状態に移行した後も、情報記憶部106にはNull値が記憶され続けている。その後、印刷用アプリ30がフォアグラウンドからバックグラウンドに移ると、情報記録部105は、アクティビティの再生成に備えて情報記憶部106に情報を一時的に保存する。情報記憶部106に保存する情報の内容は、印刷用アプリ30によって任意に設計し得る。 The information recording unit 105 temporarily stores in the information storage unit 106 information necessary for regenerating the same activity after the activity has been discarded when the printing application 30 shifts from the foreground to the background. save. For example, an instance called onSavedInstance can be used as this information storage unit 106 . When the printing application 30 is not activated at all (when neither the foreground nor the background exists), the information storage unit 106 stores a Null value. The Null value continues to be stored in the information storage unit 106 even after the printing application 30 is activated from that state and transitions to a state in which it exists in the foreground. After that, when the printing application 30 moves from the foreground to the background, the information recording unit 105 temporarily saves the information in the information storage unit 106 in preparation for regenerating the activity. The contents of the information stored in the information storage unit 106 can be arbitrarily designed by the printing application 30 .

上述の破棄判定部103は、OS10によりonCreateがコールされたとき、すなわち、印刷データ取得部101によりonCreate内で印刷データが取得されときに、情報記憶部106を参照し、当該情報記憶部106に対する情報の保存状態に基づいて、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する。すなわち、破棄判定部103は、情報記憶部106に記憶されている情報がNull値か否かを判定し、Null値であれば、アクティビティの再生成ではなく新規生成と考えられるため、印刷用アプリ30のアクティビティが破棄された状態ではないと判定する。一方、情報記憶部106に記憶されている情報がNull値でなければ、破棄判定部103は印刷用アプリ30のアクティビティが破棄された状態であると判定する。この場合に印刷制御部104は、上記(3)のケースであることを検知する。よって、印刷制御部104は、印刷データ取得部101によりonCreate内で取得された印刷データの処理を実行しないように制御する。 When onCreate is called by the OS 10, that is, when print data is acquired in onCreate by the print data acquisition unit 101, the discard determination unit 103 refers to the information storage unit 106 and Based on the information storage state, it is determined whether or not the activity of the printing application 30 has been discarded. That is, the discard determination unit 103 determines whether or not the information stored in the information storage unit 106 is a null value. 30 activities are not in a discarded state. On the other hand, if the information stored in the information storage unit 106 is not a null value, the discard determination unit 103 determines that the activity of the print application 30 has been discarded. In this case, the print control unit 104 detects that case (3) is the case. Therefore, the print control unit 104 controls not to process the print data acquired by the print data acquisition unit 101 in onCreate.

図3~図6は、以上のように構成した印刷制御装置を含む携帯端末100の動作例を示すフローチャートである。図3は、印刷の実行が指示されたときに使用中アプリ20およびOS10により実行される動作例を示す。図4は上記(1)のケースにおける印刷用アプリ30の動作例を示し、図5は上記(2)のケースにおける印刷用アプリ30の動作例を示し、図6は上記(3)のケースにおける印刷用アプリ30の動作例を示す。 3 to 6 are flow charts showing an operation example of the portable terminal 100 including the print control device configured as described above. FIG. 3 shows an operation example executed by the application 20 in use and the OS 10 when execution of printing is instructed. 4 shows an example of operation of the printing application 30 in case (1) above, FIG. 5 shows an example of operation of the printing application 30 in case (2) above, and FIG. 6 shows an example of operation of the printing application 30 in case (3) above. 4 shows an operation example of the printing application 30. FIG.

図3において、ユーザがフォアグラウンドで動作中の使用中アプリ20において印刷ボタンなどを操作して印刷命令を入力すると、使用中アプリ20は、印刷データを含むアプリ連携コマンドをOS10に対して発行する(ステップS1)。このときOS10は、印刷用アプリ30がバックグラウンドに存在しているか否かを判定し(ステップS2)、存在している場合、OS10はさらに、アクティビティが存在していたことが記憶されているかいないかまたはアクティビティが存在しない状態であるか否かを確認する(ステップS3)。 In FIG. 3, when the user inputs a print command by operating the print button or the like in the in-use application 20 running in the foreground, the in-use application 20 issues an application cooperation command including print data to the OS 10 ( step S1). At this time, the OS 10 determines whether or not the printing application 30 exists in the background (step S2). or whether there is no activity (step S3).

ここで、印刷用アプリ30がバックグラウンドに存在していないことがOS10により確認された場合(ステップS2:No)、OS10はonCreateをコールして印刷用アプリ30を起動する(ステップS4)。その後、図4の処理に進む。 Here, when the OS 10 confirms that the printing application 30 does not exist in the background (step S2: No), the OS 10 calls onCreate to activate the printing application 30 (step S4). After that, the processing proceeds to FIG.

また、印刷用アプリ30がバックグラウンドに存在し、かつ、印刷用アプリ30のアクティビティが存在していたことが記憶されていないかまたはアクティビティが存在する状態であることがOS10により確認された場合(ステップS3:No)、OS10はonNewIntentをコールして印刷用アプリ30を起動する(ステップS5)。この場合における起動は、バックグラウンドにある印刷用アプリ30をフォアグラウンドに遷移させることを意味する。その後、図5の処理に進む。 In addition, when the OS 10 confirms that the print application 30 exists in the background and that the activity of the print application 30 exists is not stored or the activity exists ( Step S3: No), the OS 10 calls onNewIntent to activate the printing application 30 (step S5). Activation in this case means transitioning the printing application 30 in the background to the foreground. After that, the processing proceeds to FIG.

また、印刷用アプリ30がバックグラウンドに存在し、かつ、印刷用アプリ30の存在していたことが記憶されているまたはアクティビティが存在していない状態であることがOS10により確認された場合(ステップS3:Yes)、OS10はonCreateをコールして印刷用アプリ30を起動する(ステップS6)。また、印刷用アプリ30がバックグラウンドに存在している状態で起動されているため、OS10はonNewIntentもコールする(ステップS7)。その後、図6の処理に進む。 Further, when the OS 10 confirms that the printing application 30 exists in the background and that the printing application 30 exists is stored or that the activity does not exist (step S3: Yes), the OS 10 calls onCreate to activate the printing application 30 (step S6). Also, since the printing application 30 is activated in the background, the OS 10 also calls onNewIntent (step S7). After that, the processing proceeds to FIG.

図4において、OS10によるonCreateのコール(図3のステップS4)を通じて起動された印刷用アプリ30は、アクティビティを新規に生成する(ステップS11)。そして、印刷データ取得部101は、アプリ連携コマンドに付与されている印刷データを、onCreate内でアクティビティが保持するIntentを利用して取得する(ステップS12)。 4, the printing application 30 activated by the onCreate call (step S4 in FIG. 3) by the OS 10 newly creates an activity (step S11). Then, the print data acquisition unit 101 acquires the print data attached to the application cooperation command using the Intent held by the activity in onCreate (step S12).

その後、破棄判定部103は、情報記憶部106を参照し、当該情報記憶部106に記憶されている情報がNull値か否かに基づいて、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する(ステップS13)。図4において破棄判定部103は、印刷用アプリ30のアクティビティが破棄された状態ではないと判定する。つまり、印刷用アプリ30のアクティビティを新規に起動する必要があると判定する。よって、印刷制御部104は、印刷データの処理を実行するように印刷データ取得部101を制御する。 After that, the discard determination unit 103 refers to the information storage unit 106, and based on whether the information stored in the information storage unit 106 is a null value, the activity of the printing application 30 is discarded. It is determined whether or not (step S13). In FIG. 4, the discard determination unit 103 determines that the activity of the print application 30 is not discarded. That is, it is determined that it is necessary to newly start the activity of the printing application 30 . Therefore, the print control unit 104 controls the print data acquisition unit 101 to process the print data.

印刷制御部104からの制御に応じて、印刷データ取得部101は、ステップS12で取得された印刷データをコマンド変換部102に供給する(ステップS14)。コマンド変換部102は、印刷データ取得部101から印刷データを受け取ると、当該印刷データをプリンタ用コマンドに変換し(ステップS15)、プリンタ200に送信する(ステップS16)。プリンタ200は、受け取ったプリンタ用コマンドに従って印刷を実行する(ステップS17)。 According to the control from the print control unit 104, the print data acquisition unit 101 supplies the print data acquired in step S12 to the command conversion unit 102 (step S14). Upon receiving the print data from the print data acquisition unit 101, the command conversion unit 102 converts the print data into printer commands (step S15), and transmits the commands to the printer 200 (step S16). The printer 200 executes printing according to the received printer command (step S17).

図5において、OS10によるonNewIntentのコール(図3のステップS5)を通じて起動された印刷用アプリ30において、印刷データ取得部101は、アプリ連携コマンドに付与されている印刷データを、onNewIntentの引数で付与されるIntentを利用して取得する(ステップS21)。この場合、破棄判定部103の処理は実行されず、印刷制御部104は、印刷データの処理を実行するように印刷データ取得部101を制御する。 In FIG. 5, in the printing application 30 activated through the onNewIntent call (step S5 in FIG. 3) by the OS 10, the print data acquiring unit 101 acquires the print data attached to the application cooperation command as an onNewIntent argument. obtained using the received Intent (step S21). In this case, the processing of the discard determination unit 103 is not executed, and the print control unit 104 controls the print data acquisition unit 101 to execute print data processing.

印刷制御部104からの制御に応じて、印刷データ取得部101は、ステップS21で取得された印刷データをコマンド変換部102に供給する(ステップS22)。コマンド変換部102は、印刷データ取得部101から印刷データを受け取ると、当該印刷データをプリンタ用コマンドに変換し(ステップS23)、プリンタ200に送信する(ステップS24)。プリンタ200は、受け取ったプリンタ用コマンドに従って印刷を実行する(ステップS25)。 According to the control from the print control unit 104, the print data acquisition unit 101 supplies the print data acquired in step S21 to the command conversion unit 102 (step S22). Upon receiving the print data from the print data acquisition unit 101, the command conversion unit 102 converts the print data into printer commands (step S23), and transmits the commands to the printer 200 (step S24). The printer 200 executes printing according to the received printer command (step S25).

図6において、OS10によるonCreateのコール(図3のステップS6)を通じて起動された印刷用アプリ30は、破棄されたアクティビティと同じアクティビティを再生成するとともに、当該アクティビティが保持していたIntentを再生成する(ステップS31)。そして、印刷データ取得部101は、破棄される前の古い印刷データがIntentとして残っていた場合は、Intentの再生成によって復元された印刷データをonCreate内で取得する(ステップS32)。なお、再生成されたIntentに印刷データが何も残っていない場合、印刷データ取得部101は印刷データを取得しない。 In FIG. 6, the printing application 30 activated through the onCreate call (step S6 in FIG. 3) by the OS 10 regenerates the same activity as the discarded activity, and also regenerates the Intent held by the activity. (step S31). Then, when the old print data before being discarded remains as an Intent, the print data acquisition unit 101 acquires the print data restored by regenerating the Intent in onCreate (step S32). If no print data remains in the regenerated Intent, the print data acquisition unit 101 does not acquire print data.

その後、破棄判定部103は、情報記憶部106を参照し、当該情報記憶部106に記憶されている情報がNull値か否かに基づいて、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する(ステップS33)。図6において破棄判定部103は、印刷用アプリ30のアクティビティが破棄された状態であると判定する。よって、印刷制御部104は、印刷データの処理を実行しないように印刷データ取得部101を制御する。これにより、印刷データ取得部101は、ステップS32で取得された印刷データをコマンド変換部102に供給しない。 After that, the discard determination unit 103 refers to the information storage unit 106, and based on whether the information stored in the information storage unit 106 is a null value, the activity of the printing application 30 is discarded. It is determined whether or not (step S33). In FIG. 6, the discard determination unit 103 determines that the activity of the printing application 30 has been discarded. Therefore, the print control unit 104 controls the print data acquisition unit 101 so as not to process the print data. Accordingly, the print data acquisition unit 101 does not supply the print data acquired in step S32 to the command conversion unit 102. FIG.

次いで、印刷データ取得部101は、OS10によりコールされたonNewIntent(図3のステップS7)を受けて、アプリ連携コマンドに付与されている印刷データを、onNewIntentの引数で付与されるIntentを利用して取得する(ステップS34)。これに応じて破棄判定部103の処理は実行されず、印刷制御部104は、印刷データの処理を実行するように印刷データ取得部101を制御する。 Next, the print data acquisition unit 101 receives onNewIntent called by the OS 10 (step S7 in FIG. 3), and converts the print data assigned to the application cooperation command using the Intent assigned as the argument of onNewIntent. Acquire (step S34). Accordingly, the processing of the discard determination unit 103 is not executed, and the print control unit 104 controls the print data acquisition unit 101 to execute print data processing.

印刷制御部104からの制御に応じて、印刷データ取得部101は、ステップS34で取得された印刷データをコマンド変換部102に供給する(ステップS35)。コマンド変換部102は、印刷データ取得部101から印刷データを受け取ると、当該印刷データをプリンタ用コマンドに変換し(ステップS36)、プリンタ200に送信する(ステップS37)。プリンタ200は、受け取ったプリンタ用コマンドに従って印刷を実行する(ステップS38)。 According to the control from the print control unit 104, the print data acquisition unit 101 supplies the print data acquired in step S34 to the command conversion unit 102 (step S35). Upon receiving the print data from the print data acquisition unit 101, the command conversion unit 102 converts the print data into printer commands (step S36), and transmits the commands to the printer 200 (step S37). The printer 200 executes printing according to the received printer command (step S38).

以上詳しく説明したように、本実施形態では、使用中アプリ20から発行されるアプリ連携コマンドによって印刷用アプリ30が起動されたときにonCreateでアクティビティが生成された場合、それより前に印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定し、アクティビティが破棄された状態であると判定された場合には、そのonCreate内で取得される印刷データの処理を実行しないようにしている。 As described in detail above, in the present embodiment, when the printing application 30 is activated by the application cooperation command issued from the application 20 in use and the activity is generated by onCreate, the printing application 30 is determined whether or not the activity is in a discarded state, and if it is determined that the activity is in a discarded state, the print data acquired in the onCreate is not processed. there is

このように構成した本実施形態によれば、印刷用アプリ30がバックグラウンドに存在し、かつ、アクティビティが内部的に破棄された状態で、印刷用アプリ30がアプリ連携コマンドにより起動された場合、破棄されたアクティビティと同じアクティビティがonCreateで再生成されたとしても、それに関連してonCreate内で取得される印刷データの処理は実行されず、onCreateのコールと並行してコールされるonNewIntentの引数で取得された印刷データの処理だけが実行されることとなる。これにより、onCreate内で取得される古い印刷データと、onNewIntentの引数で取得される新しい印刷データとに基づいて二重に印刷が行われるといった誤印刷を防止することができる。 According to this embodiment configured as described above, when the printing application 30 is in the background and the activity is internally discarded, when the printing application 30 is activated by the application cooperation command, Even if the same activity that was destroyed is recreated in onCreate, the processing of the print data obtained in onCreate in relation to it is not performed, and the onNewIntent argument that is called in parallel with the onCreate call Only the processing of the acquired print data will be executed. As a result, it is possible to prevent erroneous printing such as double printing based on the old print data acquired in onCreate and the new print data acquired by the argument of onNewIntent.

また、使用中アプリ20から送られるアプリ連携コマンドによる印刷用アプリ30の起動ではなく、OS10によって印刷用アプリ30のバックグラウンドからフォアグラウンドへの復帰が行われた場合に(例えば、画面ロック状態の解除時など)、再生成されたアクティビティのonCreate内でアクティビティが保持するIntentを利用して古い印刷データが取得されたとしても、当該古い印刷データに基づいて印刷が実行されてしまうといった誤印刷を防止することもできる。 Also, when the printing application 30 is not activated by the application cooperation command sent from the application 20 in use, but when the OS 10 returns the printing application 30 from the background to the foreground (for example, when the screen lock state is released). ), even if the old print data is obtained using the intent held by the activity in the onCreate of the regenerated activity, printing is performed based on the old print data to prevent printing errors. You can also

なお、上記実施形態では、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する方法として、onSavedInstanceと呼ばれるインスタンスで構成される情報記憶部106における情報の保存状態を確認する方法を説明したが、本発明はこれに限定されない。例えば、印刷用アプリ30が終了(シャットダウン)する際(OS10によりonDestroyのメソッドがコールされた際)に情報が保存される所定の情報記憶部を参照し、当該情報記憶部に対する情報の保存状態に基づいて、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定するようにしてもよい。 In the above embodiment, the method of determining whether the activity of the printing application 30 has been discarded is the method of confirming the saved state of information in the information storage unit 106 configured by an instance called onSavedInstance. , the invention is not limited to this. For example, when the printing application 30 terminates (shuts down) (when the onDestroy method is called by the OS 10), a predetermined information storage unit in which information is stored is referenced, and the information storage state for the information storage unit is changed. Based on this, it may be determined whether or not the activity of the printing application 30 has been discarded.

図7は、この場合における印刷制御装置の機能構成例を示す図である。この図7において、図2に示した符号と同一の符号を付したものは同一の機能を有するものであるので、ここでは重複する説明を省略する。図7に示す印刷制御装置は、図2に示した破棄判定部103、情報記録部105および情報記憶部106に代えて、破棄判定部103A、情報記録部105Aおよび情報記憶部106Aを備えている。 FIG. 7 is a diagram showing a functional configuration example of the print control device in this case. In FIG. 7, the parts denoted by the same reference numerals as those shown in FIG. 2 have the same functions, and redundant description will be omitted here. The print control apparatus shown in FIG. 7 includes a discard determination unit 103A, an information recording unit 105A and an information storage unit 106A instead of the discard determination unit 103, information recording unit 105 and information storage unit 106 shown in FIG. .

情報記録部105Aは、印刷用アプリ30が終了する際に、所定の情報を情報記憶部106Aに一時的に保存する。印刷用アプリ30が起動された場合、情報記録部105Aは、情報記録部105Aに記憶する情報を所定の情報から別の情報に書き換える。 Information recording unit 105A temporarily saves predetermined information in information storage unit 106A when printing application 30 ends. When the printing application 30 is activated, the information recording unit 105A rewrites the information stored in the information recording unit 105A from predetermined information to other information.

破棄判定部103Aは、OS10によりonCreateがコールされた場合(印刷用アプリ30の起動時にonCreateによりアクティビティが生成された場合)、情報記憶部106Aを参照し、当該情報記憶部106Aに記憶されている情報が所定の情報か否かを判定し、所定の情報であれば、アクティビティの再生成ではなく新規生成と考えられるため、印刷用アプリ30のアクティビティが破棄された状態ではないと判定する。一方、情報記憶部106Aに記憶されている情報が所定の情報でなければ、破棄判定部103Aは印刷用アプリ30のアクティビティが破棄された状態であると判定する。なお、印刷用アプリ30が携帯端末100にインストールされた後の最初の起動時は、情報記憶部106Aには何も情報が保存されていない。情報記憶部106Aに何も情報が保存されていない場合も、アクティビティの再生成ではなく新規生成と考えられるため、破棄判定部103Aは印刷用アプリ30のアクティビティが破棄された状態ではないと判定する。 When onCreate is called by the OS 10 (when an activity is generated by onCreate when the printing application 30 is activated), the discard determination unit 103A refers to the information storage unit 106A, and the information stored in the information storage unit 106A It is determined whether or not the information is predetermined information, and if it is predetermined information, it is determined that the activity of the print application 30 is not in a discarded state because it is considered that the activity is newly generated rather than regenerated. On the other hand, if the information stored in the information storage unit 106A is not predetermined information, the discard determination unit 103A determines that the activity of the print application 30 has been discarded. Note that when the printing application 30 is first started after being installed in the mobile terminal 100, no information is stored in the information storage unit 106A. Even if no information is stored in the information storage unit 106A, the activity is considered to be newly generated rather than regenerated. Therefore, the discard determination unit 103A determines that the activity of the printing application 30 is not discarded. .

また、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する別の方法として、印刷データに基づく印刷処理が実行されるたびにその実行時刻を記憶するようにした情報記憶部を参照し、当該情報記憶部に記憶されている直近の実行時刻からの経過時間が閾値未満か否かに基づいて、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定するようにしてもよい。なお、この方法は、図3のステップS6,S7ようにonCreateのコールの後にonNewIntentのコールが行われる場合ではなく、onNewIntentのコールの後にonCreateのコールが行われる場合に有効な方法である。 As another method for determining whether or not the activity of the print application 30 has been discarded, an information storage unit that stores the execution time each time print processing based on print data is executed is provided. and determines whether or not the activity of the printing application 30 has been discarded based on whether or not the elapsed time from the most recent execution time stored in the information storage unit is less than the threshold. can be This method is effective when onCreate is called after onNewIntent, not when onNewIntent is called after onCreate as in steps S6 and S7 in FIG.

図8は、この場合における印刷制御装置の機能構成例を示す図である。この図8において、図2に示した符号と同一の符号を付したものは同一の機能を有するものであるので、ここでは重複する説明を省略する。図8に示す印刷制御装置は、図2に示した破棄判定部103、情報記録部105および情報記憶部106に代えて、破棄判定部103B、情報記録部105Bおよび情報記憶部106Bを備えている。 FIG. 8 is a diagram showing a functional configuration example of the print control device in this case. In FIG. 8, the components denoted by the same reference numerals as those shown in FIG. 2 have the same functions, and redundant description will be omitted here. The print control apparatus shown in FIG. 8 includes a discard determination unit 103B, an information recording unit 105B, and an information storage unit 106B instead of the discard determination unit 103, information recording unit 105, and information storage unit 106 shown in FIG. .

情報記録部105Bは、印刷データ取得部101によって取得される印刷データに基づく印刷処理が印刷制御部104の制御に基づき実行されるたびに、その実行時刻を情報記憶部106Bに記憶する。 Information recording unit 105B stores the execution time in information storage unit 106B each time print processing based on print data acquired by print data acquisition unit 101 is executed under the control of print control unit 104 .

破棄判定部103Bは、OS10によりonCreateがコールされた場合(印刷用アプリ30の起動時にonCreateによりアクティビティが生成された場合)、印刷データ取得部101によりonCreate内で取得された印刷データに基づく印刷処理を実行する前に、情報記憶部106Bに記憶されている直近の実行時刻からの経過時間が閾値未満か否かに基づいて、印刷用アプリ30のアクティビティが破棄された状態であるか否かを判定する。ここで、閾値には、ユーザが使用中アプリ20を使用して印刷を実行する際の処理時間として想定される通常の時間よりも短い時間が設定される。 When onCreate is called by the OS 10 (when an activity is generated by onCreate when the printing application 30 is started), the discard determination unit 103B performs print processing based on the print data acquired in onCreate by the print data acquisition unit 101. is executed, based on whether the elapsed time from the most recent execution time stored in the information storage unit 106B is less than a threshold, it is determined whether the activity of the printing application 30 has been discarded. judge. Here, the threshold is set to a time that is shorter than the normal time assumed as the processing time when the user executes printing using the application 20 in use.

印刷用アプリ30がバックグラウンドに存在し、かつ、以前のアクティビティが破棄された状態で印刷用アプリ30が起動された場合、onNewIntentと、破棄されたアクティビティと同じアクティビティを再生成するためのonCreateとが並行してコールされる。この場合、onCreateよりも先にコールされたonNewIntentの引数で取得された印刷データに基づいて印刷が実行され、その実行時刻が情報記憶部106Bに記憶される。その後、onNewIntentに続いてコールされたonCreate内で取得された印刷データに基づいて、印刷処理を実行しようとする際に、破棄判定部103Bが情報記憶部106Bに記憶されている直近の実行時刻からの経過時間を計測すると、経過時間は閾値未満となる。よって、この場合、破棄判定部103Bは、印刷用アプリ30のアクティビティが破棄された状態であると判定する。 When the printing application 30 exists in the background and the printing application 30 is started with the previous activity discarded, onNewIntent and onCreate for regenerating the same activity as the discarded activity. are called in parallel. In this case, printing is executed based on the print data acquired by the argument of onNewIntent called before onCreate, and the execution time is stored in the information storage unit 106B. After that, when attempting to execute print processing based on the print data acquired in onCreate called after onNewIntent, the discard determination unit 103B When the elapsed time is measured, the elapsed time is less than the threshold. Therefore, in this case, the discard determination unit 103B determines that the activity of the print application 30 has been discarded.

その他、上記実施形態は、何れも本発明を実施するにあたっての具体化の一例を示したものに過ぎず、これによって本発明の技術的範囲が限定的に解釈されてはならないものである。すなわち、本発明はその要旨、またはその主要な特徴から逸脱することなく、様々な形で実施することができる。 In addition, the above-described embodiments are merely examples of specific implementations of the present invention, and the technical scope of the present invention should not be construed in a limited manner. Thus, the invention may be embodied in various forms without departing from its spirit or essential characteristics.

10 OS
20 使用中アプリ(印刷データ生成用アプリ)
30 印刷用アプリ
100 携帯端末
101 印刷データ取得部
102 コマンド変換部
103,103A,103B 破棄判定部
104 印刷制御部
105,105A,105B 情報記録部
106,106A,106B 情報記憶部
200 プリンタ
10OS
20 App in use (application for generating print data)
30 print application 100 mobile terminal 101 print data acquisition unit 102 command conversion unit 103, 103A, 103B discard determination unit 104 print control unit 105, 105A, 105B information recording unit 106, 106A, 106B information storage unit 200 printer

Claims (6)

ホスト端末においてフォアグラウンドで動作中のアプリケーションである使用中アプリからアプリ連携コマンドによって印刷制御用のアプリケーションである印刷用アプリを起動し、上記使用中アプリにより生成された印刷データに基づいて上記印刷用アプリがプリンタでの印刷を実行するようになされたシステムにおいて、上記印刷用アプリによって印刷の実行を制御する印刷制御装置であって、
上記印刷用アプリの起動時にアクティビティが生成された場合、それより前に上記印刷用アプリのアクティビティが破棄された状態であるか否かを判定する破棄判定部と、
上記印刷用アプリのアクティビティが破棄された状態であると上記破棄判定部により判定された場合、破棄されたアクティビティを再利用するために再生成されたアクティビティに関連して取得される印刷データの処理を実行しないように制御する印刷制御部とを備えた
ことを特徴とする印刷制御装置。
A printing application, which is an application for controlling printing, is started from the application in use, which is an application running in the foreground on the host terminal, by an application cooperation command, and the printing application is based on the print data generated by the application in use. in a system configured to execute printing with a printer, a printing control device for controlling execution of printing by the printing application,
a discard determination unit that determines whether or not the activity of the printing application has been discarded before the activity is generated when the printing application is activated;
When the discard determination unit determines that the activity of the printing application is in a discarded state, processing print data acquired in relation to the activity regenerated to reuse the discarded activity and a print control unit that controls not to execute.
上記印刷用アプリがフォアグラウンドからバックグラウンドに移行する際に、上記アクティビティが破棄された後にそれと同じアクティビティの再生成を行う際に必要となる情報を情報記憶部に保存する情報記録部を更に備え、
上記破棄判定部は、上記印刷用アプリの起動時にアクティビティが生成された場合、上記情報記憶部を参照し、当該情報記憶部に対する情報の保存状態に基づいて、上記印刷用アプリのアクティビティが破棄された状態であるか否かを判定することを特徴とする請求項1に記載の印刷制御装置。
further comprising an information recording unit for storing, in an information storage unit, information necessary for regenerating the same activity after the activity has been discarded when the printing application transitions from the foreground to the background;
The discard determination unit refers to the information storage unit when an activity is generated when the printing application is activated, and discards the activity of the printing application based on the state of information storage in the information storage unit. 2. The print control apparatus according to claim 1, wherein it is determined whether or not the print control apparatus is in a
上記印刷用アプリが終了する際に、所定の情報を情報記憶部に保存する情報記録部を更に備え、
上記破棄判定部は、上記印刷用アプリの起動時にアクティビティが生成された場合、上記情報記憶部を参照し、当該情報記憶部に対する情報の保存状態に基づいて、上記印刷用アプリのアクティビティが破棄された状態であるか否かを判定することを特徴とする請求項1に記載の印刷制御装置。
further comprising an information recording unit that saves predetermined information in an information storage unit when the printing application is terminated;
The discard determination unit refers to the information storage unit when an activity is generated when the printing application is activated, and discards the activity of the printing application based on the state of information storage in the information storage unit. 2. The print control apparatus according to claim 1, wherein it is determined whether or not the print control apparatus is in a
上記印刷データに基づく印刷処理が実行されるたびに、その実行時刻を情報記憶部に記憶する印刷時刻記録部を更に備え、
上記破棄判定部は、上記印刷用アプリの起動時にアクティビティが生成された場合、上記印刷データに基づく印刷処理を実行する前に、上記情報記憶部に記憶されている直近の実行時刻からの経過時間が閾値未満か否かに基づいて、上記印刷用アプリのアクティビティが破棄された状態であるか否かを判定することを特徴とする請求項1に記載の印刷制御装置。
a print time recording unit that stores an execution time in an information storage unit each time a print process based on the print data is executed;
When the activity is generated when the printing application is started, the discard determination unit determines whether the print processing based on the print data is executed after the elapsed time from the most recent execution time stored in the information storage unit. 2. The print control apparatus according to claim 1, wherein whether or not the activity of the print application has been discarded is determined based on whether or not is less than a threshold.
ホスト端末においてフォアグラウンドで動作中のアプリケーションである使用中アプリからアプリ連携コマンドによって印刷制御用のアプリケーションである印刷用アプリを起動し、上記使用中アプリにより生成された印刷データに基づいて上記印刷用アプリがプリンタでの印刷を実行するようになされたシステムにおいて、上記印刷用アプリによって印刷の実行を制御する方法であって、
上記ホスト端末が備えるコンピュータの破棄判定部が、上記印刷用アプリの起動時にアクティビティが生成された場合、それより前に上記印刷用アプリのアクティビティが破棄された状態であるか否かを判定する第1のステップと、
上記コンピュータの印刷制御部が、上記印刷用アプリのアクティビティが破棄された状態であると上記破棄判定部により判定された場合、破棄されたアクティビティを再利用するために再生成されたアクティビティに関連して取得される印刷データの処理を実行しないように制御する第2のステップとを有する
ことを特徴とする印刷制御方法。
A printing application, which is an application for controlling printing, is started from the application in use, which is an application running in the foreground on the host terminal, by an application cooperation command, and the printing application is based on the print data generated by the application in use. A method for controlling execution of printing by the printing application in a system configured to execute printing with a printer, comprising:
A discard determination unit of a computer included in the host terminal determines whether or not the activity of the print application has been discarded before the activity is generated when the print application is activated. 1 step;
When the discard determination unit determines that the printing application activity is in a discarded state, the print control unit of the computer is associated with the activity regenerated to reuse the discarded activity. and a second step of performing control so as not to process the print data acquired by the second step.
ホスト端末においてフォアグラウンドで動作中のアプリケーションである使用中アプリからアプリ連携コマンドによって印刷制御用のアプリケーションである印刷用アプリを起動し、上記使用中アプリにより生成された印刷データに基づいて上記印刷用アプリがプリンタでの印刷を実行するようになされたシステムにおいて、上記印刷用アプリとして実装される印刷用プログラムであって、
上記印刷用アプリの起動時にアクティビティが生成された場合、それより前に上記印刷用アプリのアクティビティが破棄された状態であるか否かを判定する破棄判定手段、および
上記印刷用アプリのアクティビティが破棄された状態であると上記破棄判定手段により判定された場合、破棄されたアクティビティを再利用するために再生成されたアクティビティに関連して取得される印刷データの処理を実行しないように制御する印刷制御手段
としてコンピュータを機能させるための印刷用プログラム。
A printing application, which is an application for controlling printing, is started from the application in use, which is an application running in the foreground on the host terminal, by an application cooperation command, and the printing application is based on the print data generated by the application in use. A printing program implemented as the printing application in a system configured to execute printing on a printer,
Discard determination means for determining whether or not the activity of the printing application has been discarded before the activity is generated when the printing application is activated, and the activity of the printing application is discarded. printing that controls not to execute processing of print data acquired in relation to an activity regenerated in order to reuse the discarded activity when the discard determination means determines that the discarded activity A printing program that allows a computer to function as a control means.
JP2021031046A 2021-02-26 2021-02-26 Printing control device, printing control method and program for printing Pending JP2022131859A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021031046A JP2022131859A (en) 2021-02-26 2021-02-26 Printing control device, printing control method and program for printing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2021031046A JP2022131859A (en) 2021-02-26 2021-02-26 Printing control device, printing control method and program for printing

Publications (1)

Publication Number Publication Date
JP2022131859A true JP2022131859A (en) 2022-09-07

Family

ID=83153615

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2021031046A Pending JP2022131859A (en) 2021-02-26 2021-02-26 Printing control device, printing control method and program for printing

Country Status (1)

Country Link
JP (1) JP2022131859A (en)

Similar Documents

Publication Publication Date Title
US9560116B2 (en) Network device, system, method, and storage medium
US10860395B2 (en) Event processing method, non-transitory computer-readable storage medium for storing program
US9971557B2 (en) Information processing apparatus, control method, and storage medium
US8730490B2 (en) Printer driver, information processing apparatus, and computer program product
JP5397162B2 (en) Printer driver and POS printer control method
JP6371697B2 (en) Information processing apparatus, print control method, and program
JP2001067228A (en) Firmware down loading system
JP2015231155A (en) Communication system, information processing device and control method thereof, and program
JP4577225B2 (en) Information processing apparatus, control method for information processing apparatus, and control program
US9917964B2 (en) Information processing apparatus, information system, information processing method, and storage medium
JP2022131859A (en) Printing control device, printing control method and program for printing
CN109947592A (en) A kind of method of data synchronization, device and relevant device
JP6740583B2 (en) Information processing system, information processing apparatus, and information processing method
JP2015212052A (en) Image formation device, control method thereof, and program
US11604615B2 (en) Printing system for suppressing wasteful transmission of notification information
US20170277985A1 (en) Print control device, method and non-transitory computer readable medium storing program
JP2006129362A (en) Digital composite machine
JP2009233922A (en) Printer, printer system and printer control server
CN114356799A (en) Data storage method, device, system and computer readable storage medium
JP2016165851A (en) Memory controller, image formation apparatus and resource management method of memory controller
JP2021149191A (en) Information processing apparatus, and information processing method
JP2000343772A (en) Printing system
JP2013101560A (en) Printer, control method therefor, and program therefor
JP2007219720A (en) Peripheral device of computer, and install method of its software
JP6221317B2 (en) Electronic device and communication system